<?php
// 本类由系统自动生成，仅供测试用途
class IndexAction extends Action {
	public function __construct() {
		if ($_SESSION['is_login'] == 1) {
			$this -> assign('is_login', 1);
			$this -> assign('user_id', $_SESSION['user_id']);
			$this -> assign('nick', $_SESSION['nike']);
		}
	}

	//首页
	public function index() {
		$this -> assign('cate', 'index');
		$this -> display();
	}

	//问题列表页
	public function problem() {
		$m = M('problem') -> field('id,title,submit,solved') -> order('in_date asc') -> select();
		$this -> assign('data', $m);
		$this -> assign('cate', 'problem');
		$this -> display();
	}

	//状态列表页
	public function status() {
		$this -> assign('cate', 'status');
		$this -> display();
	}

	//榜单页面
	public function rank() {
		$this -> assign('cate', 'rank');
		$this -> display();
	}

	//竞赛页
	public function contest() {
		$this -> assign('cate', 'contest');
		$this -> display();
	}

	//登录页
	public function login() {
		$this -> assign('cate', 'login');
		$this -> display();
	}
	
	public function admin_login(){
		$this->display();
	}
	
	//注册页
	public function register() {
		$this -> assign('cate', 'register');
		$this -> display();
	}

	public function do_login() {

	}

	public function do_register() {

	}
	
	public function do_logout(){
		$_SESSION=NULL;
		$this->redirect('Index/index');
	}

}
